package cn.smdq.ch.gateway.core.route;

import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.cloud.netflix.zuul.filters.ZuulProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * @author shuimodanqing
 * create at:  2019/1/24  5:42 PM
 * @description 动态路由配置
 */
@Configuration
public class ZuulRouteConfig {

    @Bean
    public RedisZuulRouteLocator redisZuulRouteLocator(ServerProperties properties, ZuulProperties zuulProperties, RedisTemplate redisTemplate) {
        return new RedisZuulRouteLocator(properties.getServlet().getPath(), zuulProperties, redisTemplate);
    }
}
